﻿//using BaseUtils.Helper;
//using Service.src.NW.Enum;
//using Service.src.NW.Model;
//using Service.src.NW.Model.Drive;
//using System;
//using System.Collections.Generic;
//using System.IO;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;

//namespace Service.src.Flow.Server
//{
//    public class SysPlcDriverAdressServer
//    {
//        internal SysPlcDriverAddress AddAddress(int DBIndex, SysPlcDriverAddress address)
//        {
//            address = AppData.DatabaseCache[DBIndex].Install<SysPlcDriverAddress>(address);
//            return address;
//        }

//        internal bool DeleteAddress(int DBIndex, int id)
//        {
//            return AppData.DatabaseCache[DBIndex].Delete(new SysPlcDriverAddress() { Id = id });
//        }

//        internal SysPlcDriverAddress GetAddressInfoById(int DBIndex, int Id)
//        {
//            SysPlcDriverAddress Info = AppData.DatabaseCache[DBIndex].Query<SysPlcDriverAddress>(i => i.Id == Id).FirstOrDefault();
//            if (Info == null)
//            {
//                throw new Exception("获取地址异常，找不此地址");
//            }
//            return Info;
//        }

//        internal List<SysPlcDriverAddress> GetAddresslist(int DBIndex, int DriverId)
//        {
//            List<SysPlcDriverAddress> list = AppData.DatabaseCache[DBIndex].Query<SysPlcDriverAddress>(i=>i.DriverId==DriverId);
//            return list;
//        }

//        internal List<SysPlcDriverAddress> GetAllAddresslist(int DBIndex)
//        {
//            List<SysPlcDriverAddress> list = AppData.DatabaseCache[DBIndex].QueryAll<SysPlcDriverAddress>();
//            return list;
//        }
//        /// <summary>
//        /// 获取PLC地址
//        /// </summary>
//        /// <param name="DriverType"></param>
//        /// <returns></returns>
//        internal List<SysPlcDriverAddress> QueryByDriverType(int DBIndex, string DriverType)
//        {
//            DeviceTypeEnum d = DriverType.ToEnum<DeviceTypeEnum>();
//            List<SysPlcDriverAddress> list = AppData.DatabaseCache[DBIndex].Query<SysPlcDriverAddress>(i => i.DriverType == d);
//            return list;
//        }

//        internal int UpldateAddress(int DBIndex, SysPlcDriverAddress address)
//        {
//            int i = AppData.DatabaseCache[DBIndex].Update(address);
//            return i;
//        }
//    }
//}
